function time(){
    var ma = document.getElementById("ma");
    var times =document.getElementById("times");
    var checkBox = document.getElementById("checkBox");
    var phone_number = document.getElementById("phone_number");
    if (phone_number.value >= 10000000000 && phone_number.value <= 19999999999){
        console.log(checkBox.checked);
        if (checkBox.checked === true){
            ma.style.display="none";
            times.style.display="inline";
            startCountdown();
        }else {
            alert("请同意并勾选用户协议！")
        }
    }else {
        alert("输入的手机号不正确！")
    }

}

function startCountdown() {
    var secondsLeft = 5; // 初始化剩余时间为10秒
    var times =document.getElementById("times");
    var phone_number = document.getElementById("phone_number");
    phone_number.setAttribute("disabled","true");
    function updateDisplay() {
        if (secondsLeft > 0) {
            times.textContent= secondsLeft + "s";
            setTimeout(updateDisplay, 1000); // 每隔1秒更新一次倒计时显示
            secondsLeft--; // 减少剩余时间
        } else {
            times.textContent= secondsLeft + "s";
            triggerEvent(); // 倒计时结束后触发事件
        }
    }
    updateDisplay(); // 调用第一次更新倒计时显示
}

function triggerEvent() {
    var ma = document.getElementById("ma");
    var times =document.getElementById("times");
    var phone_number = document.getElementById("phone_number");
    phone_number.removeAttribute("disabled");
    ma.style.display="inline";
    times.style.display="none";
}